package com.peterelst.draw3D
{
	import flash.display.Sprite;
	
	public class Plane3D
	{
		
		public var point1:Point3D;
		public var point2:Point3D;
		public var point3:Point3D;
		public var point4:Point3D;
		
		public var target:Sprite;
		
		public function Plane3D(pt1:Point3D, pt2:Point3D, pt3:Point3D, pt4:Point3D, t:Sprite)
		{
			point1 = pt1;
			point2 = pt2;
			point3 = pt3;
			point4 = pt4;			
			target = t;
	
			draw();
		}

		public function draw():void
		{
			var point1_2D:Point2D = point1.to2D();
			var point2_2D:Point2D = point2.to2D();
			var point3_2D:Point2D = point3.to2D();
			var point4_2D:Point2D = point4.to2D();			
			
			target.graphics.moveTo(point1_2D.x, point1_2D.y);
			target.graphics.lineTo(point2_2D.x, point2_2D.y);
			target.graphics.lineTo(point3_2D.x, point3_2D.y);
			target.graphics.lineTo(point4_2D.x, point4_2D.y);
			target.graphics.lineTo(point1_2D.x, point1_2D.y);
		}		

	}
}